<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@page import="perucuy.domain.Detalle"%>
<%@page import="perucuy.transfers.PersonaTO"%>
<%@page import="perucuy.transfers.PozoTO"%>
<html:html />
<logic:present name="mensajeBusqueda">
    <strong>${mensajeBusqueda}</strong>
</logic:present>
<html:errors/>
<logic:messagesPresent message="true">
    <ul class="mensajes">
        <html:messages id="msg" message="true">
            <li>${msg}</li>
        </html:messages>
    </ul>
</logic:messagesPresent>
<html:form action="/operador/agregarTarea">
<table border="0" cellSpacing="0" cellPadding="0" width="471">
    <tr>
        <td colspan="3"><img src="<html:rewrite page="/resources/images/background_border_top.jpg"/>" /></td>
    </tr>
    <tr>
        <td width="10" class="leftcaja">&nbsp;</td>
        <td >
        <table border="0" cellSpacing="0" cellPadding="0" width="451">
            <tr>
                <td width="451" height="22"colspan="2" class="titlerow"> INGRESAR TAREA</td>
            </tr>
            <td colspan="2" width="451" >&nbsp;</td>
            <tr class="style12">
                <td height="25"><bean:message key="tarea.fecprog" />: </td>
                <td height="25">
                    <html:text property="fec_prog" size="10" maxlength="10" styleId="fec_prog"/>&nbsp;(dd/mm/aaaa)
                </td>
            </tr>
            <tr class="style12">
                <td height="25"><bean:message key="tarea.hora" />: </td>
                <td height="25">
                    <html:text property="hor_prog" size="8" maxlength="8" styleId="hor_prog" />&nbsp;(hh:mm)
                </td>
            </tr>
            <tr class="style12">
                <td width="100" height="25"><span class="style12"><bean:message key="tarea.tipo" />: </span></td>
                <td width="351" height="25"><span class="style12"> 
                        <html:select property="id_tipo" onchange="cambiarTabla();" styleId="tipotarea">
                            <html:option value="">:: Seleccione Tarea ::</html:option>
                            <logic:present name="listaTipoTarea">
                                <html:options collection="listaTipoTarea" property="codigo" labelProperty="descripcion"/>
                            </logic:present>
                        </html:select>
                </span> </td>
            </tr>
            <tr class="style12">
                <td height="25"><span class="style12"><bean:message key="tarea.responsa" />: </span></td>
                <td height="25" ><span class="style12"> 
                        <html:select property="id_responsable">
                            <html:option value="">:: Seleccione Responsable ::</html:option>
                            <logic:present name="listaResponsable">
                                <html:options collection="listaResponsable" property="codigopersona" labelProperty="apellidosNombres"/>
                            </logic:present>
                        </html:select>
                </span></td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25"><bean:message key="tarea.desc" />:</td>
                <td height="25" valign="top" >
                    <html:textarea property="descripcion" styleId="descripcion" />
                </td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25"><bean:message key="tarea.esta" />: </td>
                <td height="25" valign="top" >Pendiente</td>
            </tr>
            <tr valign="top" class="style12"><td colspan="2">
                    <strong>SELECCIONAR UBICACION DE LA TAREA:</strong>
                    <%
                    String ruta = request.getContextPath()+"/operador/buscarUbicacion.do";
                    %>
                    <a target="buscar" onclick="return abrirVentana(this);" href="<%=ruta%>">
                        <img src="<html:rewrite page="/resources/images/download.gif"/>" width="15" height="15" border="0" alt="Buscar Ubicacion"/>
                    </a>
                    <br>
                    <img src="<html:rewrite page="/resources/images/spacer.gif"/>" height="12"/>
                    <table width="89%" border="0" cellpadding="0" cellspacing="1" id="tablaUbica">
                        <html:hidden property="ids_pozo" value="" styleId="todocod"/>
                        <tr valign="top">
                            <td width="218" height="43" bgcolor="#666666" class="Estilo83">
                                <table width="110%" border="0" cellspacing="0" cellpadding="0" style="FONT-SIZE: 0pt">
                                    <tr class="titulo_cab_grilla">
                                        <td width="81%" >UBICACION</td>
                                        <td width="19%" align="right" ><img src="<html:rewrite page="/resources/images/productos_triangulo.gif"/>" width="20" height="30" /></td>
                                    </tr>
                                    <tr class="titulo_cab_grilla">
                                        <td >&nbsp;</td>
                                        <td >&nbsp;</td>
                                    </tr>
                            </table></td>
                            <td width="234" bgcolor="#666666">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0" style="FONT-SIZE: 0pt">
                                    <tr>
                                        <td width="90%" class="titulo_cab_grilla"><div align="center"><span class="Estilo83">CANTIDAD ANIMALES </span></div></td>
                                        <td width="10%" align="right" valign="top" bgcolor="#666666">
                                            <img src="<html:rewrite page="/resources/images/productos_triangulofinal.gif"/>" width="12"                                                                                      height="30" />
                                        </td>
                                    </tr>
                            </table></td>
                        </tr>
                        <tr valign="middle">
                            <td colspan="4" bgcolor="#cccccc"><img src="<html:rewrite page="/resources/images/2x2.gif"/>" width="2" height="2" /></td>
                        </tr>
                        <tbody id="cuerpoLista">
                        </tbody>
                    </table>
            </td></tr>
            <tr>
                <td >&nbsp;</td>
                <td >&nbsp;</td>
            </tr>
            
        </table>
        <td width="10" class="rightcaja">&nbsp;</td>
    </tr>
    <tr><td colspan="3"><img src="<html:rewrite page="/resources/images/background_border_bottom.jpg"/>" /></td></tr>
</table>
<img src="<html:rewrite page="/resources/images/spacer.gif"/>" height="12"/><br>
<table border="0" cellSpacing="0" cellPadding="0" width="471" style="display:none" id="tabla1">
    <tr>
        <td colspan="3"><img src="<html:rewrite page="/resources/images/background_border_top.jpg"/>" /></td>
    </tr>
    <tr>
        <td width="10" class="leftcaja">&nbsp;</td>
        <td >
        <table border="0" cellSpacing="0" cellPadding="0" width="451">
            <tr>
                <td height="22"colspan="2" class="titlerow">DATOS DE LA ALIMENTACION</td>
            </tr>
            <td colspan="2" >&nbsp;</td>
            <tr class="style12">
                <td height="25" colspan="2">
                    <logic:present name="listaClaseAlimento">
                        <logic:iterate id="clase" name="listaClaseAlimento">
                            <html:radio property="id_clasealimento" value="${clase.codigo}" styleId="clasealimento" onclick="deshabilitarRadio(${clase.codigo});"/>${clase.descripcion}
                        </logic:iterate>
                    </logic:present>
                </td>
            </tr>
            <tr class="style12" id="alimIndi" style="display:none">
                <td width="95" height="25"><span class="style12">Cod.Arete</span></td>
                <td width="356" height="25"><span class="style12">
                        <html:text property="id_aretealimento" size="5" maxlength="5" styleId="aretealimento"/>
                </span></td>
            </tr>
            <tr class="style12" id="alimGrupo" style="display:none">
                <td width="95" height="25"><span class="style12"> Grupo </span></td>
                <td width="356" height="25"><span class="style12">
                        <html:select property="id_grupoalimento" styleId="grupoalimento">
                            <logic:present name="listaGrupoAlimento">
                                <html:options collection="listaGrupoAlimento" property="codigo" labelProperty="descripcion"/>
                            </logic:present>
                        </html:select>
                        <html:text property="id_aretealimento" size="5" maxlength="5" styleId="aretealimento" style="display:none"/>
                </span></td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25">Tipo de alimento </td>
                <td height="25" valign="top">
                    <html:select property="id_tipoalimento">
                        <logic:present name="listaTipoAlimento">
                            <html:options collection="listaTipoAlimento" property="codigo" labelProperty="descripcion"/>
                        </logic:present>
                    </html:select>
                </td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25">Alimento</td>
                <td height="25" valign="top" > 
                    <html:hidden property="id_racionalimento" value="" styleId="cod_racion"/>
                    <input name="textfield" type="text" disabled size="40" id="txtracion" />
                    <%String rutaRacion = request.getContextPath()+"/operador/buscarAlimento.do";
                    %>
                    <a target="buscar" onclick="return abrirVentana(this);" href="<%=rutaRacion%>">
                        <img src="<html:rewrite page="/resources/images/previo.gif"/>" width="17" height="14" border="0" />
                    </a> 
                </td>
            </tr>
            <tr>
                <td >&nbsp;</td>
                <td >&nbsp;</td>
            </tr>
        </table>
        <td width="10" class="rightcaja">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="3">
            <img src="<html:rewrite page="/resources/images/background_border_bottom.jpg"/>"/>
        </td>
    </tr>
</table>
<table border="0" cellSpacing="0" cellPadding="0" width="471" id="tabla2">
    <tr>
        <td colspan="3"><img src="<html:rewrite page="/resources/images/background_border_top.jpg"/>" /></td>
    </tr>
    <tr>
        <td width="10" class="leftcaja">&nbsp;</td>
        <td >
        <table border="0" cellSpacing="0" cellPadding="0" width="451">
            <tr>
                <td height="22"colspan="2" class="titlerow"> DATOS DEL TRATAMIENTO </td>
            </tr>
            <td colspan="2" >&nbsp;</td>
            <tr class="style12">
                <td height="25" colspan="2">
                    <logic:present name="listaClaseAlimento">
                        <logic:iterate id="clase" name="listaClaseAlimento">
                            <html:radio property="id_clasetratamiento" value="${clase.codigo}" styleId="clasetratamiento" onclick="deshabilitarRadio(${clase.codigo});"/>${clase.descripcion}
                        </logic:iterate>
                    </logic:present>
                </td>
            </tr>
            <tr class="style12" id="trataIndi" style="display:none">
                <td width="128" height="25"><span class="style12"> Cod.Arete </span></td>
                <td width="323" height="25"><span class="style12"> 
                        <html:text property="id_aretetratamiento" size="5" maxlength="5" styleId="aretetratamiento"/>
                </span></td>
            </tr>
            <tr class="style12" id="trataGrupo" style="display:none">
                <td width="128" height="25"><span class="style12"> Grupo </span></td>
                <td width="323" height="25"><span class="style12"> 
                        <html:select property="id_grupotratamiento" styleId="grupotratamiento">
                            <logic:present name="listaGrupoAlimento">
                                <html:options collection="listaGrupoAlimento" property="codigo" labelProperty="descripcion"/>
                            </logic:present>
                        </html:select>
                </span></td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25">Tipo de tratamiento</td>
                <td height="25" valign="top">
                    <html:select property="id_tipotratamiento">
                        <logic:present name="listaTipoTratamiento">
                            <html:options collection="listaTipoTratamiento" property="codigo" labelProperty="descripcion"/>
                        </logic:present>
                    </html:select>
                </td>
            </tr>
            <tr valign="top" class="style12">
                <td height="25">Ruta</td>
                <td height="25" valign="top">
                    <html:select property="id_rutatratamiento">
                        <logic:present name="listaRutaTratamiento">
                            <html:options collection="listaRutaTratamiento" property="codigo" labelProperty="descripcion"/>
                        </logic:present>
                    </html:select>
                </td>
            </tr>
            <tr>
                <td >&nbsp;</td>
                <td >&nbsp;</td>
            </tr>
        </table>
        <td width="10" class="rightcaja">&nbsp;</td>
    </tr>
    <tr><td colspan="3">
            <img src="<html:rewrite page="/resources/images/background_border_bottom.jpg"/>" />
    </td></tr>
</table>
<img src="<html:rewrite page="/resources/images/spacer.gif"/>" height="12"/><br>
<center>
    <table border="0" cellspacing="0" cellpadding="0" width="256">
        <tr>
            <td valign="center">&nbsp;</td>
            <td valign="center">&nbsp;</td>
            <td valign="left">&nbsp;</td>
            <td valign="left">&nbsp;</td>
        </tr>
        <tr>
            <td width="24" valign="center">&nbsp;</td>
            <td width="104" valign="center">
                <html:submit styleClass="button" property="boton">
                    <bean:message key="boton.guardar"/>
                </html:submit>
            </td>
            <td width="104" valign="left">
                <html:cancel styleClass="button">
                    <bean:message key="boton.cancelar"/>
                </html:cancel>
            </td>
            <td width="24" valign="left">&nbsp;</td>
        </tr>
    </table>
    </td>					
</center>
</html:form>
<script type="text/javascript">
  cambiarTabla();
  estadoFilaClase('<%=request.getParameter("id_clasealimento")%>', '<%=request.getParameter("id_clasetratamiento")%>');
  mostrarPozaTarea('<%=request.getParameter("ids_pozo")%>');
  mostrarRacion('<%=request.getParameter("id_racionalimento")%>');
</script>